#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include "src/Manager/AppManager/SingleApplication.h"
#include "src/Manager/AppManager/MRegisterCPlus.h"

int main(int argc, char *argv[])
{

    QGuiApplication::setApplicationName("zxxSelf");
    QGuiApplication::setOrganizationName("zxxSelf");
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

    SingleApplication app(argc, argv,"zxxSelf Application");
    app._initCommon();

    /*
        ** 2019-04-24
        ** Getting Engine Context
    */
    QQmlContext *context = app.getRootContext();
    MRegisterCPlus registerContext(context);


    /*
        ** 2019-04-24
        ** Register C++ and Controls ,then load QML file
    */
    registerContext._StartRegster();
    int ret = app._loadQMLFile();
    if(-1 == ret){
        app.quit();
    }

    /*
        ** 2019-04-24
        ** Call this method to get the QML root object after the component is loaded
    */
    QObject *rootObj=app.getRootObject();
    MPropertyMap::GetInstance()->setRootObject(rootObj);

    return app.exec();

}
